/**
 * 
 */
var oTable;
$(function(){
	//初始化
	initDataTable();
});

function initDataTable(cid, ds, ipcc) {
	oTable = $('.example').DataTable({
		"dom": '<"top">rt<"bottom"ip><"clear">',
		"ajax": {
			"url": "fajax",
			"data": function(d) {
				d.id = $('#mid').val()
			}
		},
		"ordering": false,
		"aLengthMenu": [5, 20, 50, 100 ],
		"iDisplayLength" : 100,
		"oLanguage": {
			"sUrl": "../static/js/datatable.cn.txt"
		},
		"aoColumns": [
			{"mDataProp":"id"},
			{"mDataProp":"fromCity"},
			{"mDataProp":"fromCountry"},
			{"mDataProp":"toCity"},
			{"mDataProp":"toCountry"},
			{"mDataProp":"flightType"},
			{"mDataProp":"flightStatus"},
			{"mDataProp":"openStatus"},
			{"mDataProp":"status"}
		],
		"columnDefs": [
			{
			    "render": function ( data, type, row ) {
			 	   if(row.flightType == 'oneWay') {
			 		   return '单程';
			 	   } else {
			 		   return '往返';
			 	   }
			    },
			    "targets": 5
			},
			{
			    "render": function ( data, type, row ) {
			 	   if(row.flightStatus == '1') {
			 		   return '开启';
			 	   } else {
			 		   return '关闭';
			 	   }
			    },
			    "targets": 6
			},
			{
			    "render": function ( data, type, row ) {
			 	   if(row.openStatus == '1') {
			 		   return '开启';
			 	   } else {
			 		   return '关闭';
			 	   }
			    },
			    "targets": 7
			},
           {
               "render": function ( data, type, row ) {
            	   if(row.status == '1') {
            		   return '<span class="glyphicon glyphicon-ok" aria-hidden="true">一致</span>';
            	   } else {
            		   return '<span class="glyphicon glyphicon-warning-sign" aria-hidden="true">不一致</span>';
            	   }
               },
               "targets": 8
           }
       ]
	});
};